﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;

namespace Payroll.Biz.Legacy.Models
{
    public class BiWeeklySchedule : IPaymentSchedule
    {
        public DateTime GetPayPeriodStartDate(DateTime date)
        {
            return date.AddDays(-13);
        }

        public bool IsPayDate(DateTime payDate)
        {
            return (payDate.DayOfWeek == DayOfWeek.Friday) && (payDate.Day % 2 == 0);
        }

        public override string ToString()
        {
            return $"{{Bi-weekly payment schedule}}";
        }

        public override bool Equals(object obj)
        {
            return obj is BiWeeklySchedule;
        }

        public override int GetHashCode()
        {
            return RuntimeHelpers.GetHashCode(this);
        }
    }
}
